#!/usr/bin/python
# -*- coding:utf-8 -*-
# SwitchDoc Labs 2/22/14
# example driver for BM017 and TCS34725
import sys
sys.path.append('../')
from SDL_PC_BM017CS import SDL_BM017
from Adafruit_I2C import Adafruit_I2C
import time
import smbus



bm017 = SDL_BM017(1)

bm017.debug = True # 打开dabug输出
# bm017.debug = False

bm017.readStatus()
bm017.isSDL_BM017There()
bm017.getColors()
bm017.readStatus()

bm017.disableDevice()
bm017.setIntegrationTimeAndGain(SDL_BM017.TCS34725_INTEGRATIONTIME_154MS, SDL_BM017.TCS34725_GAIN_4X)

bm017.getColors()
print "#########################"
print "clear_color= ", bm017.clear_color
print "red_color= ", bm017.red_color
print "green_color= ", bm017.green_color
print "blue_color= ", bm017.blue_color

bm017.readStatus()
bm017.readStatus()

# this will turn on the LED if LEDON is connected to INT and LEDVDD is connected to VDD_LED
bm017.setInterrupt(True)
time.sleep(1.0)
bm017.setInterrupt(False)
